<script setup lang="ts">
const model = defineModel()
const emits = defineEmits(['onUpdate'])

const inputRef = ref()

const handleClick = () => {
  inputRef.value.click();
}

const handleFileChange = (_event: Event ) => {
  // const file = event.target.files[0]
  // emits('onUpdate', inputRef.value.value)
  model.value = inputRef.value.value
}
</script>

<template>
  <el-button class="input-button" @click="handleClick">浏览</el-button>
  <input class="input-file" type="file" ref="inputRef" @change="handleFileChange" />
</template>

<style scoped lang="scss">
  .input {
    &-file {
      position: absolute;
      z-index: -1;
      left: 0;
    }
  }
</style>